using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Spread.Common.Features.Sample;
using Spread.Common.DataStore;
using FarPoint.Win.Spread;
using FarPoint.PDF;
using Spread.PDFExport.CustomForm;
using FarPoint.Win.Spread.CellType;
using FarPoint.Win.Spread.Chart;
using Spread.Common.DataStore.Models;

namespace Spread.PDFExport
{
    public partial class CustomPDFExport : BaseSampleControl
    {
        private string _ownerPassword = null;
        private string _userPassword = null;
        private PrintInfo _printInfo;
        private PrintingInformation _printingForm;
        public CustomPDFExport()
        {
            InitializeComponent();
            InitializeControls();
            SetupSpreadSheet();
        }
        private void InitializeControls()
        {
            _printInfo = new PrintInfo();
            Name = "Custom PDF Export";
            permissionComboBox.DroppedDown = false;
          
            foreach(object item in Enum.GetValues(typeof(PdfPermissions)))
            {
                permissionListBox.Items.Add(item);
            }
        }

        private void FlowPanel_SizeChanged(object sender, EventArgs e)
        {
           foreach(Control control in flowPanel.Controls)
            {
                control.Width = flowPanel.Width - 10;
            }
        }

        private void PermissionListBox_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if(e.Index == permissionListBox.Items.Count - 1)
            {
                if (e.NewValue == CheckState.Checked)
                {
                    for (int count = 0; count < permissionListBox.Items.Count-1; count++)
                    {
                        permissionListBox.SetItemChecked(count, true);
                    }
                }
                else
                {
                    for (int count = 0; count < permissionListBox.Items.Count-1; count++)
                    {
                        permissionListBox.SetItemChecked(count, false);
                    }
                }
            }
        }

        private void Controls_Click(object sender, MouseEventArgs e)
        {
            if (!permissionListBox.Bounds.Contains(e.Location))
                permissionListBox.Visible = false;
        }

        private void PermissionComboBox_MouseClick(object sender, MouseEventArgs e)
        {
            permissionComboBox.DroppedDown = false;
            permissionListBox.Visible = !permissionListBox.Visible;
        }

        private void SetupSpreadSheet()
        {
            sheetView.ColumnHeader.Rows[0].Height = 30;
   
            sheetView.DataAutoSizeColumns = false;
            sheetView.Rows.Default.Height = 50;
            sheetView.DataSource = GetDataTable();
            sheetView.AlternatingRows[1].BackColor = Color.WhiteSmoke;
            sheetView.Columns.Add(sheetView.Columns.Count, 1);
            sheetView.Columns[sheetView.Columns.Count-1].Label = "Overall Result";
            sheetView.Columns[sheetView.Columns.Count-1].Width = 120;

            SheetCellRange[] cellRange = new SheetCellRange[sheetView.Rows.Count];
            SheetCellRange[] locationCellRange = new SheetCellRange[sheetView.Rows.Count];
            for (int row = 0; row < sheetView.Rows.Count; row++)
            {
                cellRange[row] = new SheetCellRange(sheetView, row, 1, 1, sheetView.Columns.Count - 2);
                locationCellRange[row] = new SheetCellRange(sheetView, row, sheetView.Columns.Count-1, 1, 1);
            }
            ExcelSparklineSetting setting = new ExcelSparklineSetting();
            setting.ShowMarkers = true;
            setting.ShowNegative = true;
            setting.NegativeColor = Color.Red;
            setting.SeriesColor = Color.Olive;
            sheetView.AddSparkline(cellRange, locationCellRange, SparklineType.Column, setting);

        }
        private DataTable GetDataTable()
        {
            List<Student> students = new DataService().StudentDashboardDataSource.GetAllStudents();
            DataTable table = new DataTable();
            table.Columns.Add("StudentName", typeof(string));
            table.Columns.Add("Physics", typeof(int));
            table.Columns.Add("Chemistry", typeof(int));
            table.Columns.Add("Math", typeof(int));
            table.Columns.Add("English", typeof(int));
            table.Columns.Add("Music", typeof(int));

            Random random = new Random();
            foreach (Student student in students)
            {
                table.Rows.Add(student.Name, random.Next(30, 100), random.Next(30, 100), random.Next(30, 100),random.Next(30,100),random.Next(30,100));
            }
            return table;
        }
        private void PrintInfoButton_Click(object sender, EventArgs e)
        {
            _printingForm = new PrintingInformation(sheetView,_printInfo);
            _printingForm.ShowDialog(); 
        }

        private void ExportButton_Click(object sender,EventArgs e)
        {
            if (ownerTextBox.Text == "" || userTextBox.Text == "")
            {
                MessageBox.Show("Password can not be blank");
                return;
            }
            if (ownerTextBox.Text == userTextBox.Text)
            {
                MessageBox.Show("OwnerPassword and UserPassword can not be same");
                return;
            }
            _ownerPassword = ownerTextBox.Text;
            _userPassword = userTextBox.Text;
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.Filter = "Pdf file (*.pdf)| *.pdf";
            saveFileDialog.Title = "Save Spread to PDF Format.";
            if(saveFileDialog.ShowDialog() == DialogResult.OK)
            {
               
                _printInfo.PrintToPdf = true;
                _printInfo.PdfWriteMode = PdfWriteMode.New;
                _printInfo.PdfWriteTo = PdfWriteTo.File;
                _printInfo.PdfFileName = saveFileDialog.FileName;
                _printInfo.PdfSecurity = new PdfSecurity(_ownerPassword, _userPassword, GetPermissions());
                _printInfo.PrintType = PrintType.CellRange;
                sheetView.PrintInfo = _printInfo;
                spread.PrintSheet(sheetView);

                ownerTextBox.Text = userTextBox.Text = "";
                permissionComboBox.SelectedIndex = permissionComboBox.Items.Count - 1;
                MessageBox.Show("Sheet exported as PDF ");
            }
        }
        private PdfPermissions GetPermissions()
        {
            PdfPermissions result = PdfPermissions.None;
            foreach(var item in permissionListBox.CheckedItems)
            {
                result |= (PdfPermissions)item;
            }
            return result;
        }

    }

}


//
//CustomPDFExport.Designer.cs
//


namespace Spread.PDFExport
{
    partial class CustomPDFExport
    {
        /// <summary> 
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary> 
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Component Designer generated code

        /// <summary> 
        /// Required method for Designer support - do not modify 
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.spread = new FarPoint.Win.Spread.FpSpread();
            this.sheetView = new FarPoint.Win.Spread.SheetView();
            this.permissionListBox = new System.Windows.Forms.CheckedListBox();
            this.permissionLabel = new System.Windows.Forms.Label();
            this.permissionComboBox = new System.Windows.Forms.ComboBox();
            this.userTextBox = new System.Windows.Forms.TextBox();
            this.userLabel = new System.Windows.Forms.Label();
            this.ownerTextBox = new System.Windows.Forms.TextBox();
            this.ownerLabel = new System.Windows.Forms.Label();
            this.printInfoButton = new System.Windows.Forms.Button();
            this.flowPanel = new System.Windows.Forms.FlowLayoutPanel();
            this.exportButton = new System.Windows.Forms.Button();
            this.pnlMain.SuspendLayout();
            this.pnlControls.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.spread)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.sheetView)).BeginInit();
            this.flowPanel.SuspendLayout();
            this.SuspendLayout();
            // 
            // pnlMain
            // 
            this.pnlMain.Controls.Add(this.spread);
            // 
            // pnlControls
            // 
            this.pnlControls.Controls.Add(this.flowPanel);
            this.pnlControls.MouseClick += new System.Windows.Forms.MouseEventHandler(this.Controls_Click);
            // 
            // spread
            // 
            this.spread.Dock = System.Windows.Forms.DockStyle.Fill;
            this.spread.Location = new System.Drawing.Point(0, 0);
            this.spread.Name = "spread";
            this.spread.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] {
            this.sheetView});
            this.spread.Size = new System.Drawing.Size(477, 487);
            this.spread.TabIndex = 0;
            this.spread.MouseClick += new System.Windows.Forms.MouseEventHandler(this.Controls_Click);
            // 
            // sheetView
            // 
            this.sheetView.Reset();
            this.sheetView.SheetName = "CustomPDF";
            // Formulas and custom names must be loaded with R1C1 reference style
            this.sheetView.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1;
            this.sheetView.Columns.Default.Width = 90F;
            this.sheetView.Rows.Default.Height = 25F;
            this.sheetView.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1;
            // 
            // permissionListBox
            // 
            this.permissionListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.permissionListBox.FormattingEnabled = true;
            this.permissionListBox.Location = new System.Drawing.Point(3, 133);
            this.permissionListBox.Margin = new System.Windows.Forms.Padding(3, 0, 3, 5);
            this.permissionListBox.Name = "permissionListBox";
            this.permissionListBox.Size = new System.Drawing.Size(143, 94);
            this.permissionListBox.TabIndex = 15;
            this.permissionListBox.Visible = false;
            this.permissionListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.PermissionListBox_ItemCheck);
            // 
            // permissionLabel
            // 
            this.permissionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.permissionLabel.Location = new System.Drawing.Point(3, 93);
            this.permissionLabel.Margin = new System.Windows.Forms.Padding(3);
            this.permissionLabel.Name = "permissionLabel";
            this.permissionLabel.Size = new System.Drawing.Size(143, 13);
            this.permissionLabel.TabIndex = 13;
            this.permissionLabel.Text = "Permission";
            this.permissionLabel.MouseClick += new System.Windows.Forms.MouseEventHandler(this.Controls_Click);
            // 
            // permissionComboBox
            // 
            this.permissionComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.permissionComboBox.DropDownHeight = 1;
            this.permissionComboBox.FormattingEnabled = true;
            this.permissionComboBox.IntegralHeight = false;
            this.permissionComboBox.Location = new System.Drawing.Point(3, 112);
            this.permissionComboBox.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
            this.permissionComboBox.Name = "permissionComboBox";
            this.permissionComboBox.Size = new System.Drawing.Size(143, 21);
            this.permissionComboBox.TabIndex = 12;
            this.permissionComboBox.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PermissionComboBox_MouseClick);
            // 
            // userTextBox
            // 
            this.userTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.userTextBox.Location = new System.Drawing.Point(3, 67);
            this.userTextBox.Name = "userTextBox";
            this.userTextBox.Size = new System.Drawing.Size(143, 20);
            this.userTextBox.TabIndex = 11;
            this.userTextBox.MouseClick += new System.Windows.Forms.MouseEventHandler(this.Controls_Click);
            // 
            // userLabel
            // 
            this.userLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.userLabel.Location = new System.Drawing.Point(3, 48);
            this.userLabel.Margin = new System.Windows.Forms.Padding(3);
            this.userLabel.Name = "userLabel";
            this.userLabel.Size = new System.Drawing.Size(143, 13);
            this.userLabel.TabIndex = 10;
            this.userLabel.Text = "User Password";
            this.userLabel.MouseClick += new System.Windows.Forms.MouseEventHandler(this.Controls_Click);
            // 
            // ownerTextBox
            // 
            this.ownerTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.ownerTextBox.Location = new System.Drawing.Point(3, 22);
            this.ownerTextBox.Name = "ownerTextBox";
            this.ownerTextBox.Size = new System.Drawing.Size(143, 20);
            this.ownerTextBox.TabIndex = 9;
            this.ownerTextBox.MouseClick += new System.Windows.Forms.MouseEventHandler(this.Controls_Click);
            // 
            // ownerLabel
            // 
            this.ownerLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.ownerLabel.Location = new System.Drawing.Point(3, 3);
            this.ownerLabel.Margin = new System.Windows.Forms.Padding(3);
            this.ownerLabel.Name = "ownerLabel";
            this.ownerLabel.Size = new System.Drawing.Size(143, 13);
            this.ownerLabel.TabIndex = 8;
            this.ownerLabel.Text = "Owner Password";
            this.ownerLabel.MouseClick += new System.Windows.Forms.MouseEventHandler(this.Controls_Click);
            // 
            // printInfoButton
            // 
            this.printInfoButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.printInfoButton.Location = new System.Drawing.Point(3, 235);
            this.printInfoButton.Name = "printInfoButton";
            this.printInfoButton.Size = new System.Drawing.Size(143, 23);
            this.printInfoButton.TabIndex = 16;
            this.printInfoButton.Text = "Configure PrintInfo";
            this.printInfoButton.UseVisualStyleBackColor = true;
            this.printInfoButton.Click += new System.EventHandler(this.PrintInfoButton_Click);
            // 
            // flowPanel
            // 
            this.flowPanel.Controls.Add(this.ownerLabel);
            this.flowPanel.Controls.Add(this.ownerTextBox);
            this.flowPanel.Controls.Add(this.userLabel);
            this.flowPanel.Controls.Add(this.userTextBox);
            this.flowPanel.Controls.Add(this.permissionLabel);
            this.flowPanel.Controls.Add(this.permissionComboBox);
            this.flowPanel.Controls.Add(this.permissionListBox);
            this.flowPanel.Controls.Add(this.printInfoButton);
            this.flowPanel.Controls.Add(this.exportButton);
            this.flowPanel.Dock = System.Windows.Forms.DockStyle.Fill;
            this.flowPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
            this.flowPanel.Location = new System.Drawing.Point(0, 0);
            this.flowPanel.Name = "flowPanel";
            this.flowPanel.Size = new System.Drawing.Size(157, 487);
            this.flowPanel.TabIndex = 0;
            this.flowPanel.SizeChanged += new System.EventHandler(this.FlowPanel_SizeChanged);
            // 
            // exportButton
            // 
            this.exportButton.Location = new System.Drawing.Point(3, 264);
            this.exportButton.Name = "exportButton";
            this.exportButton.Size = new System.Drawing.Size(143, 23);
            this.exportButton.TabIndex = 14;
            this.exportButton.Text = "Export";
            this.exportButton.UseVisualStyleBackColor = true;
            this.exportButton.Click += new System.EventHandler(this.ExportButton_Click);
            // 
            // CustomPDFExport
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Name = "CustomPDFExport";
            this.pnlMain.ResumeLayout(false);
            this.pnlControls.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.spread)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.sheetView)).EndInit();
            this.flowPanel.ResumeLayout(false);
            this.flowPanel.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion
        private FarPoint.Win.Spread.FpSpread spread;
        private FarPoint.Win.Spread.SheetView sheetView;
        private System.Windows.Forms.CheckedListBox permissionListBox;
        private System.Windows.Forms.Label permissionLabel;
        private System.Windows.Forms.ComboBox permissionComboBox;
        private System.Windows.Forms.TextBox userTextBox;
        private System.Windows.Forms.Label userLabel;
        private System.Windows.Forms.TextBox ownerTextBox;
        private System.Windows.Forms.Label ownerLabel;
        private System.Windows.Forms.Button printInfoButton;
        private System.Windows.Forms.FlowLayoutPanel flowPanel;
        private System.Windows.Forms.Button exportButton;
    }
}


//
//PrintingInformation.cs
//


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FarPoint.Win.Spread;
namespace Spread.PDFExport.CustomForm
{
    public partial class PrintingInformation : Form
    {
        private SheetView sheetView;
        private PrintInfo _printInfo;
        public PrintingInformation(SheetView _sheetView,PrintInfo printInfo)
        {
            InitializeComponent();       
            sheetView = _sheetView;
            _printInfo = printInfo;
            InitControls();
        }

        private void CancelButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void OkButton_Click(object sender, EventArgs e)
        {
            foreach(Control control in this.Controls)
            {
                if (control.GetType() == typeof(GroupBox))
                {
                    foreach(Control childControl in control.Controls)
                    {
                        if (childControl.GetType() == typeof(NumericUpDown))
                        {
                            typeof(PrintInfo).GetProperty(childControl.Tag.ToString()).SetValue(_printInfo, (int)((NumericUpDown)childControl).Value);
                        }
                    }
                }
            }

            _printInfo.Header = customHeaderTxtBox.Text;
            _printInfo.Footer = customFooterTxtBox.Text;

            _printInfo.ShowRowHeader = (PrintHeader)rowHeaderCBX.SelectedItem;
            _printInfo.ShowColumnHeader = (PrintHeader)columnHeaderCBX.SelectedItem;
            _printInfo.ShowBorder = borderCKB.Checked;
            _printInfo.ShowGrid = gridLineCKB.Checked;
            _printInfo.ShowColor = colorCKB.Checked;
            _printInfo.UseMax = false;
            sheetView.PrintInfo = _printInfo;

            this.Close();
        }

        private void InitControls()
        {
            rowStartUpDown.Maximum = rowEndUpDown.Maximum = repeatRStartUpDown.Maximum = repeatREndUpDown.Maximum = sheetView.Rows.Count - 1;
            columnStartUpDown.Maximum = columnEndUpDown.Maximum = repeatCEndUpDown.Maximum = repeatCStartUpDown.Maximum = sheetView.Columns.Count - 1;
            
            columnHeaderCBX.DataSource = Enum.GetValues(typeof(PrintHeader));
            rowHeaderCBX.DataSource = Enum.GetValues(typeof(PrintHeader));
            rowHeaderCBX.SelectedItem = PrintHeader.Show;
            columnHeaderCBX.SelectedItem = PrintHeader.Show;
        }
    }
}


//
//PrintingInformation.Designer.cs
//


namespace Spread.PDFExport.CustomForm
{
    partial class PrintingInformation
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.locationGRPBox = new System.Windows.Forms.GroupBox();
            this.columnEndUpDown = new System.Windows.Forms.NumericUpDown();
            this.columnEndLabel = new System.Windows.Forms.Label();
            this.columnStartUpDown = new System.Windows.Forms.NumericUpDown();
            this.columnStartLabel = new System.Windows.Forms.Label();
            this.rowEndUpDown = new System.Windows.Forms.NumericUpDown();
            this.rowEndLabel = new System.Windows.Forms.Label();
            this.rowStartUpDown = new System.Windows.Forms.NumericUpDown();
            this.rowStartLabel = new System.Windows.Forms.Label();
            this.repeatGRPBox = new System.Windows.Forms.GroupBox();
            this.repeatCEndUpDown = new System.Windows.Forms.NumericUpDown();
            this.repeatCEndLabel = new System.Windows.Forms.Label();
            this.repeatCStartUpDown = new System.Windows.Forms.NumericUpDown();
            this.repeatCStartLabel = new System.Windows.Forms.Label();
            this.repeatREndUpDown = new System.Windows.Forms.NumericUpDown();
            this.repeatREndLabel = new System.Windows.Forms.Label();
            this.repeatRStartUpDown = new System.Windows.Forms.NumericUpDown();
            this.repeatRStartLabel = new System.Windows.Forms.Label();
            this.headerGRPBox = new System.Windows.Forms.GroupBox();
            this.columnHeaderCBX = new System.Windows.Forms.ComboBox();
            this.columnHeaderLabel = new System.Windows.Forms.Label();
            this.rowHeaderCBX = new System.Windows.Forms.ComboBox();
            this.rowHeaderLabel = new System.Windows.Forms.Label();
            this.cancelButton = new System.Windows.Forms.Button();
            this.okButton = new System.Windows.Forms.Button();
            this.customHeaderGRPBox = new System.Windows.Forms.GroupBox();
            this.customFooterTxtBox = new System.Windows.Forms.TextBox();
            this.customHeaderTxtBox = new System.Windows.Forms.TextBox();
            this.customFooterLabel = new System.Windows.Forms.Label();
            this.customHeaderLabel = new System.Windows.Forms.Label();
            this.boundaryGRPBox = new System.Windows.Forms.GroupBox();
            this.colorCKB = new System.Windows.Forms.CheckBox();
            this.gridLineCKB = new System.Windows.Forms.CheckBox();
            this.borderCKB = new System.Windows.Forms.CheckBox();
            this.locationGRPBox.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.columnEndUpDown)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.columnStartUpDown)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.rowEndUpDown)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.rowStartUpDown)).BeginInit();
            this.repeatGRPBox.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.repeatCEndUpDown)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.repeatCStartUpDown)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.repeatREndUpDown)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.repeatRStartUpDown)).BeginInit();
            this.headerGRPBox.SuspendLayout();
            this.customHeaderGRPBox.SuspendLayout();
            this.boundaryGRPBox.SuspendLayout();
            this.SuspendLayout();
            // 
            // locationGRPBox
            // 
            this.locationGRPBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.locationGRPBox.Controls.Add(this.columnEndUpDown);
            this.locationGRPBox.Controls.Add(this.columnEndLabel);
            this.locationGRPBox.Controls.Add(this.columnStartUpDown);
            this.locationGRPBox.Controls.Add(this.columnStartLabel);
            this.locationGRPBox.Controls.Add(this.rowEndUpDown);
            this.locationGRPBox.Controls.Add(this.rowEndLabel);
            this.locationGRPBox.Controls.Add(this.rowStartUpDown);
            this.locationGRPBox.Controls.Add(this.rowStartLabel);
            this.locationGRPBox.Location = new System.Drawing.Point(13, 30);
            this.locationGRPBox.Name = "locationGRPBox";
            this.locationGRPBox.Size = new System.Drawing.Size(789, 84);
            this.locationGRPBox.TabIndex = 0;
            this.locationGRPBox.TabStop = false;
            this.locationGRPBox.Text = "Set Row Column";
            // 
            // columnEndUpDown
            // 
            this.columnEndUpDown.Location = new System.Drawing.Point(594, 50);
            this.columnEndUpDown.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            this.columnEndUpDown.Name = "columnEndUpDown";
            this.columnEndUpDown.Size = new System.Drawing.Size(120, 20);
            this.columnEndUpDown.TabIndex = 15;
            this.columnEndUpDown.Tag = "ColEnd";
            this.columnEndUpDown.Value = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            // 
            // columnEndLabel
            // 
            this.columnEndLabel.AutoSize = true;
            this.columnEndLabel.Location = new System.Drawing.Point(591, 26);
            this.columnEndLabel.Name = "columnEndLabel";
            this.columnEndLabel.Size = new System.Drawing.Size(64, 13);
            this.columnEndLabel.TabIndex = 14;
            this.columnEndLabel.Text = "ColumnEnd:";
            // 
            // columnStartUpDown
            // 
            this.columnStartUpDown.Location = new System.Drawing.Point(395, 50);
            this.columnStartUpDown.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            this.columnStartUpDown.Name = "columnStartUpDown";
            this.columnStartUpDown.Size = new System.Drawing.Size(120, 20);
            this.columnStartUpDown.TabIndex = 13;
            this.columnStartUpDown.Tag = "ColStart";
            this.columnStartUpDown.Value = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            // 
            // columnStartLabel
            // 
            this.columnStartLabel.AutoSize = true;
            this.columnStartLabel.Location = new System.Drawing.Point(392, 26);
            this.columnStartLabel.Name = "columnStartLabel";
            this.columnStartLabel.Size = new System.Drawing.Size(67, 13);
            this.columnStartLabel.TabIndex = 12;
            this.columnStartLabel.Text = "ColumnStart:";
            // 
            // rowEndUpDown
            // 
            this.rowEndUpDown.Location = new System.Drawing.Point(223, 50);
            this.rowEndUpDown.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            this.rowEndUpDown.Name = "rowEndUpDown";
            this.rowEndUpDown.Size = new System.Drawing.Size(120, 20);
            this.rowEndUpDown.TabIndex = 11;
            this.rowEndUpDown.Tag = "RowEnd";
            this.rowEndUpDown.Value = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            // 
            // rowEndLabel
            // 
            this.rowEndLabel.AutoSize = true;
            this.rowEndLabel.Location = new System.Drawing.Point(220, 26);
            this.rowEndLabel.Name = "rowEndLabel";
            this.rowEndLabel.Size = new System.Drawing.Size(51, 13);
            this.rowEndLabel.TabIndex = 10;
            this.rowEndLabel.Text = "RowEnd:";
            // 
            // rowStartUpDown
            // 
            this.rowStartUpDown.Location = new System.Drawing.Point(19, 50);
            this.rowStartUpDown.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            this.rowStartUpDown.Name = "rowStartUpDown";
            this.rowStartUpDown.Size = new System.Drawing.Size(120, 20);
            this.rowStartUpDown.TabIndex = 9;
            this.rowStartUpDown.Tag = "RowStart";
            this.rowStartUpDown.Value = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            // 
            // rowStartLabel
            // 
            this.rowStartLabel.AutoSize = true;
            this.rowStartLabel.Location = new System.Drawing.Point(16, 26);
            this.rowStartLabel.Name = "rowStartLabel";
            this.rowStartLabel.Size = new System.Drawing.Size(54, 13);
            this.rowStartLabel.TabIndex = 8;
            this.rowStartLabel.Text = "RowStart:";
            // 
            // repeatGRPBox
            // 
            this.repeatGRPBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.repeatGRPBox.Controls.Add(this.repeatCEndUpDown);
            this.repeatGRPBox.Controls.Add(this.repeatCEndLabel);
            this.repeatGRPBox.Controls.Add(this.repeatCStartUpDown);
            this.repeatGRPBox.Controls.Add(this.repeatCStartLabel);
            this.repeatGRPBox.Controls.Add(this.repeatREndUpDown);
            this.repeatGRPBox.Controls.Add(this.repeatREndLabel);
            this.repeatGRPBox.Controls.Add(this.repeatRStartUpDown);
            this.repeatGRPBox.Controls.Add(this.repeatRStartLabel);
            this.repeatGRPBox.Location = new System.Drawing.Point(13, 131);
            this.repeatGRPBox.Name = "repeatGRPBox";
            this.repeatGRPBox.Size = new System.Drawing.Size(789, 87);
            this.repeatGRPBox.TabIndex = 1;
            this.repeatGRPBox.TabStop = false;
            this.repeatGRPBox.Text = "Repeat Row Column";
            // 
            // repeatCEndUpDown
            // 
            this.repeatCEndUpDown.Location = new System.Drawing.Point(594, 44);
            this.repeatCEndUpDown.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            this.repeatCEndUpDown.Name = "repeatCEndUpDown";
            this.repeatCEndUpDown.Size = new System.Drawing.Size(120, 20);
            this.repeatCEndUpDown.TabIndex = 7;
            this.repeatCEndUpDown.Tag = "RepeatColEnd";
            this.repeatCEndUpDown.Value = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            // 
            // repeatCEndLabel
            // 
            this.repeatCEndLabel.AutoSize = true;
            this.repeatCEndLabel.Location = new System.Drawing.Point(591, 20);
            this.repeatCEndLabel.Name = "repeatCEndLabel";
            this.repeatCEndLabel.Size = new System.Drawing.Size(99, 13);
            this.repeatCEndLabel.TabIndex = 6;
            this.repeatCEndLabel.Text = "RepeatColumnEnd:";
            // 
            // repeatCStartUpDown
            // 
            this.repeatCStartUpDown.Location = new System.Drawing.Point(395, 45);
            this.repeatCStartUpDown.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            this.repeatCStartUpDown.Name = "repeatCStartUpDown";
            this.repeatCStartUpDown.Size = new System.Drawing.Size(120, 20);
            this.repeatCStartUpDown.TabIndex = 5;
            this.repeatCStartUpDown.Tag = "RepeatColStart";
            this.repeatCStartUpDown.Value = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            // 
            // repeatCStartLabel
            // 
            this.repeatCStartLabel.AutoSize = true;
            this.repeatCStartLabel.Location = new System.Drawing.Point(392, 20);
            this.repeatCStartLabel.Name = "repeatCStartLabel";
            this.repeatCStartLabel.Size = new System.Drawing.Size(102, 13);
            this.repeatCStartLabel.TabIndex = 4;
            this.repeatCStartLabel.Text = "RepeatColumnStart:";
            // 
            // repeatREndUpDown
            // 
            this.repeatREndUpDown.Location = new System.Drawing.Point(223, 45);
            this.repeatREndUpDown.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            this.repeatREndUpDown.Name = "repeatREndUpDown";
            this.repeatREndUpDown.Size = new System.Drawing.Size(120, 20);
            this.repeatREndUpDown.TabIndex = 3;
            this.repeatREndUpDown.Tag = "RepeatRowEnd";
            this.repeatREndUpDown.Value = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            // 
            // repeatREndLabel
            // 
            this.repeatREndLabel.AutoSize = true;
            this.repeatREndLabel.Location = new System.Drawing.Point(220, 20);
            this.repeatREndLabel.Name = "repeatREndLabel";
            this.repeatREndLabel.Size = new System.Drawing.Size(86, 13);
            this.repeatREndLabel.TabIndex = 2;
            this.repeatREndLabel.Text = "RepeatRowEnd:";
            // 
            // repeatRStartUpDown
            // 
            this.repeatRStartUpDown.Location = new System.Drawing.Point(19, 45);
            this.repeatRStartUpDown.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            this.repeatRStartUpDown.Name = "repeatRStartUpDown";
            this.repeatRStartUpDown.Size = new System.Drawing.Size(120, 20);
            this.repeatRStartUpDown.TabIndex = 1;
            this.repeatRStartUpDown.Tag = "RepeatRowStart";
            this.repeatRStartUpDown.Value = new decimal(new int[] {
            1,
            0,
            0,
            -2147483648});
            // 
            // repeatRStartLabel
            // 
            this.repeatRStartLabel.AutoSize = true;
            this.repeatRStartLabel.Location = new System.Drawing.Point(19, 20);
            this.repeatRStartLabel.Name = "repeatRStartLabel";
            this.repeatRStartLabel.Size = new System.Drawing.Size(89, 13);
            this.repeatRStartLabel.TabIndex = 0;
            this.repeatRStartLabel.Text = "RepeatRowStart:";
            // 
            // headerGRPBox
            // 
            this.headerGRPBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.headerGRPBox.Controls.Add(this.columnHeaderCBX);
            this.headerGRPBox.Controls.Add(this.columnHeaderLabel);
            this.headerGRPBox.Controls.Add(this.rowHeaderCBX);
            this.headerGRPBox.Controls.Add(this.rowHeaderLabel);
            this.headerGRPBox.Location = new System.Drawing.Point(13, 240);
            this.headerGRPBox.Name = "headerGRPBox";
            this.headerGRPBox.Size = new System.Drawing.Size(149, 141);
            this.headerGRPBox.TabIndex = 2;
            this.headerGRPBox.TabStop = false;
            this.headerGRPBox.Text = "Headers";
            // 
            // columnHeaderCBX
            // 
            this.columnHeaderCBX.FormattingEnabled = true;
            this.columnHeaderCBX.Location = new System.Drawing.Point(10, 114);
            this.columnHeaderCBX.Name = "columnHeaderCBX";
            this.columnHeaderCBX.Size = new System.Drawing.Size(121, 21);
            this.columnHeaderCBX.TabIndex = 3;
            // 
            // columnHeaderLabel
            // 
            this.columnHeaderLabel.AutoSize = true;
            this.columnHeaderLabel.Location = new System.Drawing.Point(10, 85);
            this.columnHeaderLabel.Name = "columnHeaderLabel";
            this.columnHeaderLabel.Size = new System.Drawing.Size(107, 13);
            this.columnHeaderLabel.TabIndex = 2;
            this.columnHeaderLabel.Text = "ShowColumnHeader:";
            // 
            // rowHeaderCBX
            // 
            this.rowHeaderCBX.FormattingEnabled = true;
            this.rowHeaderCBX.Location = new System.Drawing.Point(10, 57);
            this.rowHeaderCBX.Name = "rowHeaderCBX";
            this.rowHeaderCBX.Size = new System.Drawing.Size(121, 21);
            this.rowHeaderCBX.TabIndex = 1;
            // 
            // rowHeaderLabel
            // 
            this.rowHeaderLabel.AutoSize = true;
            this.rowHeaderLabel.Location = new System.Drawing.Point(7, 29);
            this.rowHeaderLabel.Name = "rowHeaderLabel";
            this.rowHeaderLabel.Size = new System.Drawing.Size(94, 13);
            this.rowHeaderLabel.TabIndex = 0;
            this.rowHeaderLabel.Text = "ShowRowHeader:";
            // 
            // cancelButton
            // 
            this.cancelButton.Location = new System.Drawing.Point(738, 523);
            this.cancelButton.Name = "cancelButton";
            this.cancelButton.Size = new System.Drawing.Size(75, 23);
            this.cancelButton.TabIndex = 3;
            this.cancelButton.Text = "Cancel";
            this.cancelButton.UseVisualStyleBackColor = true;
            this.cancelButton.Click += new System.EventHandler(this.CancelButton_Click);
            // 
            // okButton
            // 
            this.okButton.Location = new System.Drawing.Point(652, 523);
            this.okButton.Name = "okButton";
            this.okButton.Size = new System.Drawing.Size(75, 23);
            this.okButton.TabIndex = 4;
            this.okButton.Text = "OK";
            this.okButton.UseVisualStyleBackColor = true;
            this.okButton.Click += new System.EventHandler(this.OkButton_Click);
            // 
            // customHeaderGRPBox
            // 
            this.customHeaderGRPBox.Controls.Add(this.customFooterTxtBox);
            this.customHeaderGRPBox.Controls.Add(this.customHeaderTxtBox);
            this.customHeaderGRPBox.Controls.Add(this.customFooterLabel);
            this.customHeaderGRPBox.Controls.Add(this.customHeaderLabel);
            this.customHeaderGRPBox.Location = new System.Drawing.Point(208, 240);
            this.customHeaderGRPBox.Name = "customHeaderGRPBox";
            this.customHeaderGRPBox.Size = new System.Drawing.Size(149, 141);
            this.customHeaderGRPBox.TabIndex = 5;
            this.customHeaderGRPBox.TabStop = false;
            this.customHeaderGRPBox.Text = "Custom Header";
            // 
            // customFooterTxtBox
            // 
            this.customFooterTxtBox.Location = new System.Drawing.Point(9, 115);
            this.customFooterTxtBox.Name = "customFooterTxtBox";
            this.customFooterTxtBox.Size = new System.Drawing.Size(134, 20);
            this.customFooterTxtBox.TabIndex = 3;
            // 
            // customHeaderTxtBox
            // 
            this.customHeaderTxtBox.Location = new System.Drawing.Point(11, 58);
            this.customHeaderTxtBox.Name = "customHeaderTxtBox";
            this.customHeaderTxtBox.Size = new System.Drawing.Size(132, 20);
            this.customHeaderTxtBox.TabIndex = 2;
            // 
            // customFooterLabel
            // 
            this.customFooterLabel.AutoSize = true;
            this.customFooterLabel.Location = new System.Drawing.Point(8, 85);
            this.customFooterLabel.Name = "customFooterLabel";
            this.customFooterLabel.Size = new System.Drawing.Size(37, 13);
            this.customFooterLabel.TabIndex = 1;
            this.customFooterLabel.Text = "Footer";
            // 
            // customHeaderLabel
            // 
            this.customHeaderLabel.AutoSize = true;
            this.customHeaderLabel.Location = new System.Drawing.Point(6, 29);
            this.customHeaderLabel.Name = "customHeaderLabel";
            this.customHeaderLabel.Size = new System.Drawing.Size(42, 13);
            this.customHeaderLabel.TabIndex = 0;
            this.customHeaderLabel.Text = "Header";
            // 
            // boundaryGRPBox
            // 
            this.boundaryGRPBox.Controls.Add(this.colorCKB);
            this.boundaryGRPBox.Controls.Add(this.gridLineCKB);
            this.boundaryGRPBox.Controls.Add(this.borderCKB);
            this.boundaryGRPBox.Location = new System.Drawing.Point(408, 240);
            this.boundaryGRPBox.Name = "boundaryGRPBox";
            this.boundaryGRPBox.Size = new System.Drawing.Size(149, 141);
            this.boundaryGRPBox.TabIndex = 6;
            this.boundaryGRPBox.TabStop = false;
            this.boundaryGRPBox.Text = "Graphics";
            // 
            // colorCKB
            // 
            this.colorCKB.AutoSize = true;
            this.colorCKB.Location = new System.Drawing.Point(6, 114);
            this.colorCKB.Name = "colorCKB";
            this.colorCKB.Size = new System.Drawing.Size(77, 17);
            this.colorCKB.TabIndex = 2;
            this.colorCKB.Text = "ShowColor";
            this.colorCKB.UseVisualStyleBackColor = true;
            // 
            // gridLineCKB
            // 
            this.gridLineCKB.AutoSize = true;
            this.gridLineCKB.Location = new System.Drawing.Point(6, 71);
            this.gridLineCKB.Name = "gridLineCKB";
            this.gridLineCKB.Size = new System.Drawing.Size(92, 17);
            this.gridLineCKB.TabIndex = 1;
            this.gridLineCKB.Text = "ShowGridLine";
            this.gridLineCKB.UseVisualStyleBackColor = true;
            // 
            // borderCKB
            // 
            this.borderCKB.AutoSize = true;
            this.borderCKB.Location = new System.Drawing.Point(6, 29);
            this.borderCKB.Name = "borderCKB";
            this.borderCKB.Size = new System.Drawing.Size(84, 17);
            this.borderCKB.TabIndex = 0;
            this.borderCKB.Text = "ShowBorder";
            this.borderCKB.UseVisualStyleBackColor = true;
            // 
            // PrintingInformation
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(814, 549);
            this.Controls.Add(this.boundaryGRPBox);
            this.Controls.Add(this.customHeaderGRPBox);
            this.Controls.Add(this.okButton);
            this.Controls.Add(this.cancelButton);
            this.Controls.Add(this.headerGRPBox);
            this.Controls.Add(this.repeatGRPBox);
            this.Controls.Add(this.locationGRPBox);
            this.MaximumSize = new System.Drawing.Size(830, 588);
            this.MinimumSize = new System.Drawing.Size(830, 588);
            this.Name = "PrintingInformation";
            this.Text = "PrintingInformation";
            this.locationGRPBox.ResumeLayout(false);
            this.locationGRPBox.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.columnEndUpDown)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.columnStartUpDown)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.rowEndUpDown)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.rowStartUpDown)).EndInit();
            this.repeatGRPBox.ResumeLayout(false);
            this.repeatGRPBox.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.repeatCEndUpDown)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.repeatCStartUpDown)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.repeatREndUpDown)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.repeatRStartUpDown)).EndInit();
            this.headerGRPBox.ResumeLayout(false);
            this.headerGRPBox.PerformLayout();
            this.customHeaderGRPBox.ResumeLayout(false);
            this.customHeaderGRPBox.PerformLayout();
            this.boundaryGRPBox.ResumeLayout(false);
            this.boundaryGRPBox.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.GroupBox locationGRPBox;
        private System.Windows.Forms.NumericUpDown columnEndUpDown;
        private System.Windows.Forms.Label columnEndLabel;
        private System.Windows.Forms.NumericUpDown columnStartUpDown;
        private System.Windows.Forms.Label columnStartLabel;
        private System.Windows.Forms.NumericUpDown rowEndUpDown;
        private System.Windows.Forms.Label rowEndLabel;
        private System.Windows.Forms.NumericUpDown rowStartUpDown;
        private System.Windows.Forms.Label rowStartLabel;
        private System.Windows.Forms.GroupBox repeatGRPBox;
        private System.Windows.Forms.NumericUpDown repeatCEndUpDown;
        private System.Windows.Forms.Label repeatCEndLabel;
        private System.Windows.Forms.NumericUpDown repeatCStartUpDown;
        private System.Windows.Forms.Label repeatCStartLabel;
        private System.Windows.Forms.NumericUpDown repeatREndUpDown;
        private System.Windows.Forms.Label repeatREndLabel;
        private System.Windows.Forms.NumericUpDown repeatRStartUpDown;
        private System.Windows.Forms.Label repeatRStartLabel;
        private System.Windows.Forms.GroupBox headerGRPBox;
        private System.Windows.Forms.ComboBox columnHeaderCBX;
        private System.Windows.Forms.Label columnHeaderLabel;
        private System.Windows.Forms.ComboBox rowHeaderCBX;
        private System.Windows.Forms.Label rowHeaderLabel;
        private System.Windows.Forms.Button cancelButton;
        private System.Windows.Forms.Button okButton;
        private System.Windows.Forms.GroupBox customHeaderGRPBox;
        private System.Windows.Forms.TextBox customFooterTxtBox;
        private System.Windows.Forms.TextBox customHeaderTxtBox;
        private System.Windows.Forms.Label customFooterLabel;
        private System.Windows.Forms.Label customHeaderLabel;
        private System.Windows.Forms.GroupBox boundaryGRPBox;
        private System.Windows.Forms.CheckBox gridLineCKB;
        private System.Windows.Forms.CheckBox borderCKB;
        private System.Windows.Forms.CheckBox colorCKB;
    }
}